Skip to content

Add "Migrate to Latest Version" button and import validation with migration offer#47

Merged
JoeProgrammer88 merged 3 commits intomainfrom
copilot/add-migrate-button-data-management
Mar 21, 2026
Merged

Add "Migrate to Latest Version" button and import validation with migration offer#47
JoeProgrammer88 merged 3 commits intomainfrom
copilot/add-migrate-button-data-management

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 20, 2026

Adds data migration support to the Settings page: a dedicated migrate button in Data Management, and a validation + migration prompt when importing files with missing or malformed fields.

Storage layer (storage.ts)

  • ValidationResult interface{ isValid, hasPartialData, issues[], parsed }
  • validateImportData(jsonString) — validates without importing; distinguishes fully valid / partially valid (missing required fields) / completely invalid (bad JSON, unrecognized object)
  • buildMigratedData(data) (private) — merges partial AppData with defaults; applies existing category migration (per-type object → flat array); stamps latest version, schemaVersion, lastUpdated
  • migrateAndImport(data) — runs partial data through migration and persists
  • migrateToLatest() — migrates currently stored data in-place

UI layer (app.ts / index.html)

  • Updated importData() — validates first; on partial data shows a confirm dialog listing issues before offering migration:
    Warning: The imported file has invalid or missing data:
      - Missing version field
    Would you like to migrate the valid data to the latest format?
    
  • New migrateToLatest() — calls storage migration and reloads
  • #migrateBtn added to Data Management section in Settings; safe to run at any time against current stored data

Tests

21 new unit tests covering validateImportData (valid, partial, bad JSON, non-array fields), migrateAndImport (defaults, old category format, existing arrays), and migrateToLatest (data preserved, version updated, missing fields filled).

Original prompt

This section details on the original issue you should resolve

<issue_title>Data Update</issue_title>
<issue_description>Add a button under Data Management in the Settings page to Migrate to latest version if it is in a valid state. If it is not, we should migrate all the valid data we can to the latest format. When Importing data in the settings page, we should warn the user if there is invalid data and ask them if they would like to migrate to the latest version still. </issue_description>

Comments on the Issue (you are @copilot in this section)


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI changed the title [WIP] Add migrate button for data management in settings page Add "Migrate to Latest Version" button and import validation with migration offer Mar 20, 2026
Copilot AI requested a review from JoeProgrammer88 March 20, 2026 23:46
@JoeProgrammer88
Copy link
Copy Markdown
Member

@copilot Merge the current origin/main into this branch. The .js and .map files were removed from git tracking because the .ts code gets compiled into the output directory

Co-authored-by: JoeProgrammer88 <7156063+JoeProgrammer88@users.noreply.github.com>
Agent-Logs-Url: https://github.com/SpeakingInBits/TaskManagerWeb/sessions/b6ab78ca-1286-4da7-8f86-9ecede968ae8
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 21, 2026

@copilot Merge the current origin/main into this branch. The .js and .map files were removed from git tracking because the .ts code gets compiled into the output directory

Done in 5200d18. Merged origin/main into this branch — the compiled js/ files (app.js, storage.js, their .map and .d.ts files) have been removed from tracking. The .gitignore already covers js/*.js, js/*.js.map, and js/*.d.ts so future builds won't re-track them. All 96 tests still pass.

@JoeProgrammer88 JoeProgrammer88 marked this pull request as ready for review March 21, 2026 01:37
@JoeProgrammer88 JoeProgrammer88 merged commit a7a608e into main Mar 21, 2026
1 check passed
@JoeProgrammer88 JoeProgrammer88 deleted the copilot/add-migrate-button-data-management branch March 21, 2026 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data Update

2 participants